import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const constantRouterMap = [
  // { name: 'Login', path: '/login', component: () => import(`@/pages/pc/views/login/index.vue`) },
  {
    path: '/',
    redirect: '/web',
  },
  {
    path: '/web',
    name: 'Web',
    component: () => import('@/pages/pc/views/web/index.vue'),
    redirect: '/web/home',
    children: [
      {
        path: 'home',
        name: 'WebHome',
        meta: { index: 'home' },
        component: () => import('@/pages/pc/views/web/home/index.vue'),
      },
      {
        path: 'resume',
        name: 'WebResume',
        meta: { index: 'resume' },
        component: () => import('@/pages/pc/views/web/resume/index.vue'),
      },
      {
        path: 'conclusion',
        name: 'WebConclusion',
        meta: { index: 'conclusion' },
        component: () => import('@/pages/pc/views/web/conclusion/index.vue'),
      },
      {
        path: 'conclusion/detail',
        name: 'WebConclusionDetail',
        meta: { index: 'conclusion' },
        component: () => import('@/pages/pc/views/web/conclusion/detail.vue'),
      },
      {
        path: 'works',
        name: 'WebWorks',
        meta: { index: 'works' },
        component: () => import('@/pages/pc/views/web/works/index.vue'),
      },
      {
        path: 'works/detail',
        name: 'WebWorksDetail',
        meta: { index: 'works' },
        component: () => import(`@/pages/pc/views/web/works/detail.vue`),
      },
      {
        path: 'package',
        name: 'WebPackage',
        meta: { index: 'package' },
        component: () => import(`@/pages/pc/views/web/package/index.vue`),
      },
      {
        path: 'package/detail',
        name: 'WebPackageDetail',
        meta: { index: 'package' },
        component: () => import(`@/pages/pc/views/web/package/detail.vue`),
      },
      {
        path: 'opinion',
        name: 'WebOpinion',
        meta: { index: 'opinion' },
        component: () => import(`@/pages/pc/views/web/opinion/index.vue`),
      },
      {
        path: 'tool',
        name: 'WebTool',
        meta: { index: 'tool' },
        component: () => import(`@/pages/pc/views/web/tool/index.vue`),
      },
    ],
  },
  // {
  //   path: '/admin',
  //   component: () => import(`@/pages/pc/views/admin/layout/index.vue`),
  //   redirect: '/admin/dashboard',
  //   name: 'Admin',
  //   meta: { auth: 'admin', title: '后台管理' },
  //   children: [
  //     {
  //       path: 'dashboard',
  //       name: 'AdminDashboard',
  //       meta: { auth: 'admin', hidden: true, title: '后台管理' },
  //       component: () => import(`@/pages/pc/views/admin/dashboard/index.vue`),
  //     },
  //     {
  //       path: 'web',
  //       name: 'AdminWeb',
  //       redirect: '/admin/web/banner',
  //       component: () => import(`@/pages/pc/views/admin/web/index.vue`),
  //       meta: { auth: 'admin', title: '网站数据' },
  //       children: [
  //         {
  //           path: 'banner',
  //           name: 'AdminWebBanner',
  //           component: () => import(`@/pages/pc/views/admin/web/banner/index.vue`),
  //           meta: { auth: 'admin', title: 'Banner' },
  //         },
  //         {
  //           path: 'experience',
  //           name: 'AdminWebExperience',
  //           component: () => import(`@/pages/pc/views/admin/web/experience/index.vue`),
  //           meta: { auth: 'admin', title: '工作经历' },
  //         },
  //         {
  //           path: 'conclusion',
  //           name: 'AdminWebConclusion',
  //           component: () => import(`@/pages/pc/views/admin/web/conclusion/index.vue`),
  //           redirect: '/admin/web/conclusion/add',
  //           meta: { auth: 'admin', title: '学习总结' },
  //           children: [
  //             {
  //               path: 'add',
  //               name: 'AdminWebConclusionAdd',
  //               component: () => import(`@/pages/pc/views/admin/web/conclusion/add.vue`),
  //               meta: { auth: 'admin', title: '添加、编辑' },
  //             },
  //             {
  //               path: 'list',
  //               name: 'AdminWebConclusionList',
  //               component: () => import(`@/pages/pc/views/admin/web/conclusion/list.vue`),
  //               meta: { auth: 'admin', title: '列表' },
  //             },
  //           ],
  //         },
  //         {
  //           path: 'me',
  //           name: 'AdminWebMe',
  //           component: () => import(`@/pages/pc/views/admin/web/me/index.vue`),
  //           meta: { auth: 'admin', title: '个人数据' },
  //         },
  //         {
  //           path: 'opinion',
  //           name: 'AdminWebOpinion',
  //           component: () => import(`@/pages/pc/views/admin/web/opinion/index.vue`),
  //           meta: { auth: 'admin', title: '意见、建议' },
  //         },
  //         {
  //           path: 'works',
  //           name: 'AdminWebWorks',
  //           component: () => import(`@/pages/pc/views/admin/web/works/index.vue`),
  //           meta: { auth: 'admin', title: '作品' },
  //           redirect: '/admin/web/works/add',
  //           children: [
  //             {
  //               path: 'add',
  //               name: 'AdminWebWorksAdd',
  //               component: () => import(`@/pages/pc/views/admin/web/works/add.vue`),
  //               meta: { auth: 'admin', title: '添加、编辑' },
  //             },
  //             {
  //               path: 'list',
  //               name: 'AdminWebWorksList',
  //               component: () => import(`@/pages/pc/views/admin/web/works/list.vue`),
  //               meta: { auth: 'admin', title: '列表' },
  //             },
  //           ],
  //         },
  //         {
  //           path: 'package',
  //           name: 'AdminWebPackage',
  //           component: () => import(`@/pages/pc/views/admin/web/package/index.vue`),
  //           meta: { auth: 'admin', title: '封装' },
  //           redirect: '/admin/web/package/add',
  //           children: [
  //             {
  //               path: 'add',
  //               name: 'AdminWebPackageAdd',
  //               component: () => import(`@/pages/pc/views/admin/web/package/add.vue`),
  //               meta: { auth: 'admin', title: '添加、编辑' },
  //             },
  //             {
  //               path: 'list',
  //               name: 'AdminWebPackageList',
  //               component: () => import(`@/pages/pc/views/admin/web/package/list.vue`),
  //               meta: { auth: 'admin', title: '列表' },
  //             },
  //           ],
  //         },
  //       ],
  //     },
  //     {
  //       path: 'server',
  //       name: 'AdminServer',
  //       redirect: '/admin/server/ecs',
  //       component: () => import(`@/pages/pc/views/admin/web/index.vue`),
  //       meta: { auth: 'admin', title: 'Server' },
  //       children: [
  //         {
  //           path: 'ecs',
  //           name: 'AdminServerEcs',
  //           component: () => import(`@/pages/pc/views/admin/server/ecs/index.vue`),
  //           meta: { auth: 'admin', title: 'ECS' },
  //         },
  //         {
  //           path: 'oss',
  //           name: 'AdminServerOss',
  //           component: () => import(`@/pages/pc/views/admin/server/oss/index.vue`),
  //           meta: { auth: 'admin', title: 'OSS' },
  //         },
  //       ],
  //     },
  //     {
  //       path: 'resources',
  //       name: 'AdminResources',
  //       redirect: '/admin/resources/photo',
  //       component: () => import(`@/pages/pc/views/admin/resources/index.vue`),
  //       meta: { auth: 'admin', title: '资源' },
  //       children: [
  //         {
  //           path: 'photo',
  //           name: 'AdminResourcesPhoto',
  //           component: () => import(`@/pages/pc/views/admin/resources/photo/index.vue`),
  //           meta: { auth: 'admin', title: '照片' },
  //         },
  //         {
  //           path: 'video',
  //           name: 'AdminResourcesVideo',
  //           component: () => import(`@/pages/pc/views/admin/resources/video/index.vue`),
  //           meta: { auth: 'admin', title: '视频' },
  //         },
  //       ],
  //     },
  //     {
  //       path: 'account',
  //       name: 'AdminAccount',
  //       redirect: '/admin/account/administrator',
  //       component: () => import(`@/pages/pc/views/admin/web/index.vue`),
  //       meta: { auth: 'admin', title: '账号管理' },
  //       children: [
  //         {
  //           path: 'administrator',
  //           name: 'AdminAccountAdministrator',
  //           component: () => import(`@/pages/pc/views/admin/account/administrator/index.vue`),
  //           meta: { auth: 'admin', title: '管理员' },
  //         },
  //       ],
  //     },
  //   ],
  // },
  // 如果找不到就显示404界面
  { path: '*', redirect: '/', hidden: true },
]

const router = new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0, x: 0 }),
  routes: constantRouterMap,
})

router.beforeEach((to, from, next) => {
  next()
})

export default router
